//
//  UIKit+MKUITheme.h
//  MKUI
//
//  Created by 苏尚进 on 2021/3/21.
//  Copyright © 2021 moon. All rights reserved.
//


#import "MKUIThemeElementProtocol.h"
#import <UIKit/UIKit.h>

#define MKTHEME_define_property(name,pickerClass)\
- (id<MKUIThemeElementProtocol>)mktheme_##name{\
    pickerClass *picker = (pickerClass *)[self mktheme_getPickerForKey:[pickerClass pickerKeyForObjSelector:[NSString mktheme_setSelectorForProperty:@#name]]];\
    return picker.element;\
}\
- (void)setMktheme_##name:(id<MKUIThemeElementProtocol>)value{\
    [self mktheme_setPicker:[pickerClass pickerForObjSelector:[NSString mktheme_setSelectorForProperty:@#name] element:value]];\
}

NS_ASSUME_NONNULL_BEGIN
@interface UIView (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_alpha;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_backgroundColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_tintColor;
@end

@interface UILabel (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_text;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_font;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_textColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_highlightedTextColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_shadowColor;
@end

@interface UIImageView (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_image;
@end

@interface CALayer (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_backgroundColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_borderWidth;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_borderColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_shadowColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_strokeColor;
@end

@interface UIBarButtonItem (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_tintColor;
@end

@interface UINavigationBar (MKUITheme_Color)
@property(nonatomic,strong,nullable) UIColor *mk_titleTextColor;//标题颜色
@property(nonatomic,strong,nullable) UIFont *mk_titleTextFont;//标题字体
/**
 *  设置导航条背景颜色
 *
 *  @param backgroundColor 背景颜色
 */
- (void)mk_setBackgroundColorOfBar:(nullable UIColor *)backgroundColor;
@end

@interface UINavigationBar (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_barStyle;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_barTintColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_titleTextAttributes;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_largeTitleTextAttributes;

@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_titleTextColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_titleTextFont;
- (void)mktheme_setBackgroundColorOfBar:(id<MKUIThemeElementProtocol>)value;
@end

@interface UITableView (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_separatorColor;
@end

@interface UITabBar (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_barStyle;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_barTintColor;
@end

@interface UITextField (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_font;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_keyboardAppearance;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_textColor;
@end

@interface UITextView (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_font;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_keyboardAppearance;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_textColor;
@end

@interface UISearchBar (MKUITheme)
//#if os(iOS)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_barStyle;
//#endif
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_keyboardAppearance;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_barTintColor;
@end

@interface UIProgressView (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_progressTintColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_trackTintColor;
@end

@interface UIPageControl (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_pageIndicatorTintColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_currentPageIndicatorTintColor;
@end

@interface UIActivityIndicatorView (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_activityIndicatorViewStyle;
@end

@interface UIToolbar (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_barStyle;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_barTintColor;
@end

@interface UISwitch (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_onTintColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_thumbTintColor;
@end

@interface UISlider (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_thumbTintColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_minimumTrackTintColor;
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_maximumTrackTintColor;
@end

@interface UIPopoverPresentationController (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_backgroundColor;
@end

@interface UIButton (MKUITheme)
- (id<MKUIThemeElementProtocol>)mktheme_getImageForState:(UIControlState)state;
- (void)mktheme_setImage:(id<MKUIThemeElementProtocol>)value forState:(UIControlState)state;

- (id<MKUIThemeElementProtocol>)mktheme_backgroundImageForState:(UIControlState)state;
- (void)mktheme_setBackgroundImage:(id<MKUIThemeElementProtocol>)value forState:(UIControlState)state;

- (id<MKUIThemeElementProtocol>)mktheme_titleColorForState:(UIControlState)state;
- (void)mktheme_setTitleColor:(id<MKUIThemeElementProtocol>)value forState:(UIControlState)state;

- (id<MKUIThemeElementProtocol>)mktheme_titleForState:(UIControlState)state;
- (void)mktheme_setTitle:(id<MKUIThemeElementProtocol>)value forState:(UIControlState)state;
@end

@interface UITableViewCell (MKUITheme)
@property(nonatomic,strong,nullable) id<MKUIThemeElementProtocol> mktheme_selectionStyle;
@end

NS_ASSUME_NONNULL_END

